package sgbag1.Vues;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Stroke;

public abstract class Vue_init {

    protected Rectangle boiteEnglobante;
    protected boolean estSelectionne;
    protected boolean dessinerBoiteEnglobante;

    public Vue_init() {
        super();
    }

    public void Dessiner(Graphics g){
        Graphics2D g2 = (Graphics2D)g;
        if(dessinerBoiteEnglobante){
            Color tempColor = g2.getColor();
            Stroke tempStroke = g2.getStroke();
            float dash[] = { 2.0f };
            
            g2.setColor(new Color(0, 0, 0));
            g2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, dash, 0.0f));
            g2.drawRect(boiteEnglobante.x, boiteEnglobante.y, (int)boiteEnglobante.getWidth(), (int)boiteEnglobante.getHeight());
            
            g2.setColor(tempColor);
            g2.setStroke(tempStroke);
        }
    }

    public boolean EstClique(int x, int y) {
        return boiteEnglobante.contains(x, y);
    }

    public abstract void CalculerBoiteEnglobante();
    
    public void DessinerBoiteEnglobante(){
        dessinerBoiteEnglobante = !dessinerBoiteEnglobante;
    }
}
